# -*- coding: utf-8 -*-
"""
Module Description:
Date: 2020/8/19
Author: sxj
"""

import unicodedata


def get_str_length(string):
    if type(string) is not unicode:
        string = unicode(string)
    text_length = sum([1 for c in string if unicodedata.category(c) != 'Mn'])
    return text_length


def get_lower_case_name(text):
    """
    驼峰转下划线
    :param text:
    :return:
    """
    lst = []
    for index, char in enumerate(text):
        if char.isupper() and index != 0:
            lst.append("_")
        lst.append(char)

    return "".join(lst).lower()
